package com.androidtestintent2.huataixiang;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button startbtn = (Button) findViewById(R.id.button);
        startbtn.setOnClickListener(star);
        Button closebtn = (Button) findViewById(R.id.button2);
        closebtn.setOnClickListener(close);

    }

    private View.OnClickListener star = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            startService(new Intent("com.studio.android.START_AUDIO_SERVICE"));

        }
    };
    private View.OnClickListener close = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            stopService(new Intent("com.studio.android.START_AUDIO_SERVICE"));

        }
    };
}
